/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: 10.10.12
 * Time: 19:27
 * To change this template use File | Settings | File Templates.
 */
package zakladki.AS3.country {
public class TemperaturesDataProvider {

    private var countryXML:XML;

    public function TemperaturesDataProvider(krajXML:XML) {
        this.countryXML = krajXML;
    }

    public function getCountryTemperatures(mainRegion:Boolean, countryName:String,regionName:String):Array {
        var temperatures:Array = new Array();
        var testString:String = new String("");

        if (countryName != "" && countryName != null) {
            if (regionName == "CC") {
                testString = countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T1;
                if (testString != "") {
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T1);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T2);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T3);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T4);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T5);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T6);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T7);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T8);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T9);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T10);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T11);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name == regionName).T12);
                }
                else {
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T1);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T2);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T3);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T4);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T5);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T6);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T7);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T8);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T9);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T10);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T11);
                    temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name1 == regionName).T12);
                }
            }
            else {
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T1);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T2);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T3);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T4);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T5);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T6);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T7);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T8);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T9);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T10);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T11);
                temperatures.push(countryXML.Continent.Country.(Name == countryName).Region.(Name_pl == regionName).T12);
            }
        }
        return temperatures;
    }

}
}
